package com.topwalk.iwp.multiService.dao;

import java.util.List;

import com.topwalk.iwp.util.ToolUtil;
import com.topwalk.ws.multiService.BaseService;
import com.topwalk.ws.multiService.BaseServiceService;
import com.topwalk.ws.multiService.PeopleInfoData;
import com.topwalk.ws.multiService.PeopleServiceItem;
import com.topwalk.ws.multiService.PeopleWhere;

public class MultiServiceDao {
	
	/**
	 * 获取人员服务WS列表
	 * @param user_key
	 * @return
	 */
	public static List<PeopleServiceItem> getPeopleServiceList(String user_key){
		BaseServiceService bss = new BaseServiceService();
		BaseService bs = bss.getBaseServicePort();
		
		List<PeopleServiceItem> list = bs.getPeopleServiceList(user_key);
		
		return list;
	}
	
	/**
	 * 获取人员信息
	 * @param user_key 登录认证Key
	 * @param service_ID WS的ID
	 * @param pWhere 人员检索条件
	 * @param pageSize 每页查询记录数
	 * @param pageIndex 页码
	 * @return
	 */
	public static PeopleInfoData getPeopleData(String user_key,String service_ID,PeopleWhere pWhere,Integer pageSize,Integer pageIndex){
		BaseServiceService bss = new BaseServiceService();
		BaseService bs = bss.getBaseServicePort();
		
		PeopleInfoData pid = bs.getPeopleData(user_key, service_ID, pWhere, pageSize, pageIndex);
		System.out.println(pid.getRecordCount());
		return pid;
	}
	
	/**
	 * 封装人员信息检索条件
	 * @param jgmc 籍贯名称
	 * @param name 姓名
	 * @param sfzh 身份证号
	 * @param xxzz 详细住址
	 * @param zbmc 性别名称
	 * @return
	 */
	public static PeopleWhere getPeopleWhere(String jgmc,String name,String sfzh,String xxzz,String zbmc){
		PeopleWhere pw = new PeopleWhere();
		
		jgmc = (ToolUtil.rmNullStr(zbmc).length() == 0)?null:ToolUtil.rmNullStr(zbmc);
		name = (ToolUtil.rmNullStr(name).length() == 0)?null:ToolUtil.rmNullStr(name);
		sfzh = (ToolUtil.rmNullStr(sfzh).length() == 0)?null:ToolUtil.rmNullStr(sfzh);
		xxzz = (ToolUtil.rmNullStr(xxzz).length() == 0)?null:ToolUtil.rmNullStr(xxzz);
		zbmc = (ToolUtil.rmNullStr(zbmc).length() == 0)?null:ToolUtil.rmNullStr(zbmc);
		
		pw.setJGMC(jgmc);
		pw.setNAME(name);
		pw.setSFZH(sfzh);
		pw.setXXZZ(xxzz);
		pw.setZBMC(zbmc);
		
		return pw;
	}
}